package com.wanmait.community.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanmait.community.mapper.VisitorMapper;
import com.wanmait.community.entity.Visitor;
import com.wanmait.community.service.VisitorService;

import javax.annotation.Resource;

@Service
public class VisitorServiceImpl extends ServiceImpl<VisitorMapper, Visitor> implements VisitorService{
@Resource
private VisitorMapper visitorMapper;
    @Override
    public void insertVisitor(Visitor visitor) {
        visitorMapper.insertVisitor(visitor);
    }

    @Override
    public PageInfo<Visitor> handlelist(Visitor visitor, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Visitor> visitors = visitorMapper.handlelist(visitor);
        PageInfo<Visitor> pageInfo = new PageInfo<>(visitors,8);
        return pageInfo;
    }

    @Override
    public void deleteVisitor(Integer id) {
        visitorMapper.deleteVisitor(id);

    }

    @Override
    public Visitor selectVisitor(Integer id) {
        Visitor visitor =  visitorMapper.selectVisitor(id);
        return visitor;
    }

    @Override
    public void updateVisitor(Visitor visitor) {
        visitorMapper.updateVisitor(visitor);
    }
}
